#pragma once
#include<string>

namespace tmms{
    namespace base{
        enum RotateType{
            kRotateNone,
            kRotateMinute,
            kRotateHour,
            kRotateDay,
        };
        class FileLog{
        public:
            FileLog() = default;
            ~FileLog() = default;

            bool Open(const std::string &filepath);
            size_t WriteLog(const std::string &msg);
            void Rotate(const std::string& file);
            RotateType GetRotateType() const;
            void SetRotate(RotateType type);
            int64_t FileSize() const;
            std::string FilePath() const;
        private:
            int fd_{-1};
            std::string file_path_{""};
            RotateType Rotate_type_{kRotateNone};
        };
    }
}
